package com.navinfo.opentsp.platform.computing.analysis.entity;

import jersey.repackaged.com.google.common.base.MoreObjects;

import java.util.ArrayList;
import java.util.List;

public class AreaEntity extends Entity {

	private static final long serialVersionUID = 1L;
	private long areaId;
	private int areaType;
	private long lastUpdateTime;
	private List<AreaDataEntity> datas;


	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		AreaEntity that = (AreaEntity) o;

		return areaId == that.areaId;
	}

	public int hashCode() {
		return (int) (areaId ^ (areaId >>> 32));
	}

	public String toString() {
		return MoreObjects.toStringHelper(this)
				.add("areaId", areaId)
				.add("areaType", areaType)
				.add("lastUpdateTime", lastUpdateTime)
				.add("datas", datas)
				.toString();
	}

	public long getLastUpdateTime() {
		return lastUpdateTime;
	}

	public void setLastUpdateTime(long lastUpdateTime) {
		this.lastUpdateTime = lastUpdateTime;
	}

	public AreaEntity() {
		super();
	}

	public void addAreaDataEntity(AreaDataEntity areaDataEntity){
		if(datas == null){
			datas = new ArrayList<AreaDataEntity>();
		}
		this.datas.add(areaDataEntity);
	}

	public void addAreaDataEntity(int dataSn , long dataStatus,int radiusLength, int longitude , int latitude){
		AreaDataEntity areaDataEntity = new AreaDataEntity();
		areaDataEntity.setDataSn(dataSn);
		areaDataEntity.setLongitude(longitude);
		areaDataEntity.setLatitude(latitude);
		areaDataEntity.setDataStatus(dataStatus);
		areaDataEntity.setRadiusLength(radiusLength);
		this.addAreaDataEntity(areaDataEntity);
	}


	public long getAreaId() {
		return areaId;
	}

	public void setAreaId(long areaId) {
		this.areaId = areaId;
	}



	public int getAreaType() {
		return areaType;
	}

	public void setAreaType(int areaType) {
		this.areaType = areaType;
	}

	public List<AreaDataEntity> getDatas() {
		return datas;
	}

	public void setDatas(List<AreaDataEntity> datas) {
		this.datas = datas;
	}


}
